import VueRouter from 'vue-router'

// 导入对应的路由的组件
import homeContainer from './components/tabbar/HomeContainer.vue'
import memberContainer from './components/tabbar/MemberContainer.vue'
import searchContainer from './components/tabbar/SearchContainer.vue'
import shopcarContainer from './components/tabbar/ShopcarContainer.vue'

// 获取新闻资讯的组件
import newsList from './components/news/NewsList.vue'
import newsInfo from './components/news/NewsInfo.vue'

// 获取图文列表的组件
import photoList from './components/photos/photoList.vue'
import photoInfo from './components/photos/photoInfo.vue'

// 获取商品列表的组件
import goodsList from './components/goods/GoodsList.vue'
import goodsInfo from './components/goods/GoodsInfo.vue'
import goodsDesc from './components/goods/GoodsDesc.vue'
import goodsComment from './components/goods/GoodsComment.vue';


// 3. 创建路由对象
var router = new VueRouter({
  routes: [ // 配置路由规则
    { path: '/', redirect: '/home' },
    { path: '/home', component: homeContainer },
    { path: '/member', component: memberContainer },
    { path: '/search', component: searchContainer },
    { path: '/shopcar', component: shopcarContainer },
    { path: '/home/newslist', component: newsList },
    { path: '/home/newsInfo/:id', component: newsInfo },
    { path: '/home/photoList', component: photoList },
    { path: '/home/photoInfo/:id', component: photoInfo },
    { path: '/home/goodsList', component: goodsList },
    { path: '/home/goodsInfo/:id', component: goodsInfo, name: 'goodsinfo' },
    { path: '/home/goodsDesc/:id', component: goodsDesc, name: 'goodsDesc' },
    { path: '/home/goodsComment/:id', component: goodsComment, name: 'goodsComment' }
  ],
  linkActiveClass: 'mui-active'  // 覆盖默认的路由高亮的类，默认的类叫做 router-link-active  每点击一个规则会自动转换为这个类
})
// 把路由对象暴露出去
export default router